package main

import (
	"api-gate/global"
	__ "api-gate/proto"
	"api-gate/router"
	"github.com/gin-gonic/gin"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	"log"
)

func main() {
	InitRpc()
	r := gin.Default()
	router.LordRouter(r)
	r.Run()
}

func InitRpc() {
	conn, err := grpc.NewClient("127.0.0.1:9999", grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		log.Fatalf("did not connect: %v", err)
	}
	global.Rpc = __.NewUserClient(conn)
}
